Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#8728: Upgrade/datetimefield format #8729

Open
wants to merge 4 commits into
base: 1.10.x
Choose a base branch
from

Conversation

AgostiniAlessandro
Copy link
Contributor

@AgostiniAlessandro AgostiniAlessandro commented Oct 30, 2023

Fixes #8728

Added the AllowDisplayOptionsOverride property in DateTimeFieldSetting.

Handled this setting in DateTimeField so that it returns the overriding value (if set) or (if there's no overriding value set) the setting value.

Handles a new case in in DefaultDateLocalizationServices.cs: when converting a DateTime to and from UTC with the IgnoreDate setting, if the DateTime had a valid Date (!= DateTime.min) the code was returning a wrong value since it didn't handle the solar time correctly.
Probably this case wasn't handled correctly since DateTimeFields were only allowing the user to insert the time when their Display property was set to TimeOnly, but we decided to show both the Date and Time editors when the AllowDisplayOptionsOverride is set to true so now it's possibile to have to convert DateTime with a valid date and the IgnoreDate option set to true.

@AgostiniAlessandro
Copy link
Contributor Author

2 tests failed but when I tried to rerun them locally I got no problem. Also, since the tests that failed don't have nothing to do with the files I worked on I guess there was some problem running the test, probably some connection issues.

Here is the code for the two tests that are failing:

    [Test]
    public void StatusCodeShouldBe404ForUnexistingResources() {
        var download = _webDownloader.Download("http://orchardproject.net/yepyep");
        Assert.That(download, Is.Not.Null);
        Assert.That(download.StatusCode, Is.EqualTo(HttpStatusCode.NotFound));
        Assert.That(download.Content, Is.Null);
    }

    [Test]
    public void StatusCodeShouldBe200ForValidRequests() {
        var download = _webDownloader.Download("http://orchardproject.net/");
        Assert.That(download, Is.Not.Null);
        Assert.That(download.StatusCode, Is.EqualTo(HttpStatusCode.OK));
        Assert.That(download.Content, Is.Not.Empty);
    }

@BenedekFarkas BenedekFarkas linked an issue Apr 15, 2024 that may be closed by this pull request
@BenedekFarkas BenedekFarkas changed the title Upgrade/datetimefield format #8728: Upgrade/datetimefield format Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display option override in DateTimeField
1 participant